<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">

	<h:form id="monthCountForm">
		<div id="headDiv" class="box box-solid with-border">
			<div class="box-header" id="queryDiv">
				<p:outputLabel value="年份：" style="float:left;margin-top:5px" />
				<input type="text" id="countYear1" onchange="changeTableCountYear()"
					style="width: 80px; text-align: center; height: 30px" />
				<p:remoteCommand name="changeTableYear"
					actionListener="#{deviceFaultCountController.changeTableYear()}" />

				<p:outputLabel value="月份：" style="margin-top:5px;margin-left:10px;" />
				<h:selectOneMenu id="countMonth1" style="width:80px;height:30px"
					value="#{deviceFaultCountController.month1}">
					<f:selectItem itemValue="1" itemLabel="1月" />
					<f:selectItem itemValue="2" itemLabel="2月" />
					<f:selectItem itemValue="3" itemLabel="3月" />
					<f:selectItem itemValue="4" itemLabel="4月" />
					<f:selectItem itemValue="5" itemLabel="5月" />
					<f:selectItem itemValue="6" itemLabel="6月" />
					<f:selectItem itemValue="7" itemLabel="7月" />
					<f:selectItem itemValue="8" itemLabel="8月" />
					<f:selectItem itemValue="9" itemLabel="9月" />
					<f:selectItem itemValue="10" itemLabel="10月" />
					<f:selectItem itemValue="11" itemLabel="11月" />
					<f:selectItem itemValue="12" itemLabel="12月" />
				</h:selectOneMenu>

				<p:outputLabel value="统计方式：" style="margin-left:10px"
					rendered="#{deviceFaultCountController.showTable}" />
				<h:selectOneMenu id="countType1" style="width:120px;height:30px"
					value="#{deviceFaultCountController.unitType1}"
					rendered="#{deviceFaultCountController.showTable}">
					<f:selectItem itemLabel="按调度单位" itemValue="0" />
					<f:selectItem itemLabel="按运维单位" itemValue="1" />
					<f:selectItem itemLabel="按变电站" itemValue="2" />
				</h:selectOneMenu>

				<p:commandButton icon="ui-icon-search" value="查询" update="faultCountTb"
					rendered="#{deviceFaultCountController.showTable}"
					actionListener="#{deviceFaultCountController.query}" oncomplete="initDataTable();"
					style="margin-left:10px;" />

				<p:outputLabel value="数据源：" style="margin-left:10px"
					rendered="#{!deviceFaultCountController.showTable}" />
				<h:selectOneMenu id="dataSource1" style="width:100px;height:30px"
					rendered="#{!deviceFaultCountController.showTable}">
					<f:selectItem itemLabel="集中录波" itemValue="0" />
					<f:selectItem itemLabel="保护录波" itemValue="1" />
					<f:selectItem itemLabel="保护事件" itemValue="2" />
				</h:selectOneMenu>
				<p:commandButton icon="ui-icon-search" value="查询"
					rendered="#{!deviceFaultCountController.showTable}" onclick="initChart1DataByYearAndMonth();"
					style="margin-left:10px;" />

				<p:commandButton value="图形" style="float:right; margin-left:10px;"
					rendered="#{deviceFaultCountController.showTable}"
					actionListener="#{deviceFaultCountController.showChart}" oncomplete="showChart()"
					update="monthCountForm" />

				<p:commandButton value="表格" style="float:right; margin-left:10px;"
					rendered="#{!deviceFaultCountController.showTable}"
					actionListener="#{deviceFaultCountController.showTable}" oncomplete="initFaultCountTableYear()"
					update="monthCountForm" />

				<p:commandButton value="导出excel" ajax="false" rendered="#{deviceFaultCountController.showTable}"
					actionListener="#{deviceFaultCountController.monthFileDownLoad}" icon="ui-icon-arrowthick-1-s">
					<p:fileDownload value="#{deviceFaultCountController.file}" />
				</p:commandButton>
			</div>
		</div>
		<p:dataTable id="faultCountTb" var="unit" rendered="#{deviceFaultCountController.showTable}"
			emptyMessage="无记录" value="#{deviceFaultCountController.unitCountInfos}" scrollable="true">
			<p:columnGroup type="header">
				<p:row>
					<p:column rowspan="2" headerText="上报单位" />
					<p:column rowspan="2" headerText="上送类型" />
					<p:column colspan="5" headerText="报送情况" />
				</p:row>
				<p:row>
					<p:column headerText="上送率" />
					<p:column headerText="应上报次数" />
					<p:column headerText="实际上报次数" />
					<p:column headerText="自动上送" />
					<p:column headerText="人工上送" />
				</p:row>
			</p:columnGroup>
			<p:column style="text-align:center;" headerText="单位" groupRow="true">
				<h:outputText value="#{unit.name}" />
			</p:column>
			<p:column style="text-align:center;">
				<h:outputText value="#{unit.waveType}" />
			</p:column>
			<p:column style="text-align:center;">
				<h:outputText value="#{unit.uploadRatio}%" />
			</p:column>
			<p:column style="text-align:center;">
				<h:outputText value="#{unit.targetTotal}" />
			</p:column>
			<p:column style="text-align:center;">
				<h:outputText value="#{unit.upTotal}" />
			</p:column>
			<p:column style="text-align:center;">
				<h:outputText value="#{unit.automatic}" />
			</p:column>
			<p:column style="text-align:center;">
				<h:outputText value="#{unit.manual}" />
			</p:column>
			<p:row>
				<p:column style="text-align:right;background-color:#3C8DBC;color:#fff" footerText="总计: " />
				<p:column style="text-align:center;background-color:#3C8DBC;color:#fff"
					footerText="#{unit.uploadRatio}%" />
				<p:column style="text-align:center;background-color:#3C8DBC;color:#fff"
					footerText="#{unit.targetTotal}" />
				<p:column style="text-align:center;background-color:#3C8DBC;color:#fff"
					footerText="#{unit.upTotal}" />
				<p:column style="text-align:center;background-color:#3C8DBC;color:#fff"
					footerText="#{unit.automatic}" />
				<p:column style="text-align:center;background-color:#3C8DBC;color:#fff"
					footerText="#{unit.manual}" />
			</p:row>
			<!-- <p:columnGroup type="footer">
				<p:row>
					<p:column style="text-align:right;background-color:#3C8DBC;color:#fff" footerText="总计: " />
					<p:column style="text-align:center;background-color:#3C8DBC;color:#fff"
						footerText="#{unit.uploadRatio}%" />
					<p:column style="text-align:center;background-color:#3C8DBC;color:#fff"
						footerText="#{unit.targetTotal}" />
					<p:column style="text-align:center;background-color:#3C8DBC;color:#fff"
						footerText="#{unit.upTotal}" />
					<p:column style="text-align:center;background-color:#3C8DBC;color:#fff"
						footerText="#{unit.automatic}" />
					<p:column style="text-align:center;background-color:#3C8DBC;color:#fff"
						footerText="#{unit.manual}" />
				</p:row>
			</p:columnGroup> -->
			
		</p:dataTable>
		<div class="nav-tabs-custom" id="divId" style="display: none;">
			<div class="tab-content no-padding" style="overflow: auto; height: 680px">
				<div class="col-xs-12">
					<div class="box box-primary">
						<div class="box-header with-border">
							<h4 id="chart1Title" class='box-title' />
						</div>
						<div class="box-body">
							<div id="chart1"
								style="height: 350px; margin: 0 auto; text-align: center; color: grey; font-size: 16px; font-weight: bold" />
						</div>
					</div>
				</div>
				<div class="col-xs-12">
					<div class="box box-primary">
						<div class="box-header with-border">
							<h4 id="chart2Title" class='box-title' />
						</div>
						<div class="box-body">
							<div id="chart2"
								style="height: 350px; margin: 0 auto; text-align: center; color: grey; font-size: 16px; font-weight: bold" />
						</div>
					</div>
				</div>
			</div>
		</div>
	</h:form>
</ui:composition>
